<template>
	<scroll-view class="content" scroll-y="true" @scrolltolower="getMore()">
		<view class="commentBox">
			<view class="commentTop">
				<view class="commentLabel">
					评价
				</view>
				<view class="commentTotal">
					（{{comment.count}}条）
				</view>
			</view>
			<view class="commentItem" v-for="(item,index) in comment.data" :key="index">
				<view class="userInfoBox">
					<image :src="item.head" class="avatar"></image>
					<text class="name ellipsis">{{item.name}}</text>
					<uni-rate :value="item.score" size="18" color="#C4C4C4" activeColor="#000000" class="rate" />
				</view>
				<text class="commentInfo">{{item.content}}</text>
				<!-- <view class="commentImgBox">
					<image :src="item1.url" v-for="(item1,index1) in item.thumb" :key="index1" class="commentImgItem">
					</image>
				</view> -->
			</view>
		</view>
		</scroll-view>
</template>
<script>
	export default {
		data() {
			return {
				baseUrl: this.$baseUrl,
				id: '',
				comment: '',
				page: 1
			}
		},
		onLoad(options) {
			this.id = options.id;
			this.getData();
		},
		methods: {
			getMore() {
				this.page++;
				this.$request.get(`evaluate_list?service_id=${this.id}&page=${this.page}`).then(res => { //获取评论
					this.comment.data.push(...res.data.data);
				})
			},
			getData() {
				this.$request.get(`evaluate_list?service_id=${this.id}`).then(res => { //获取评论
					this.comment = res.data;
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	.commentBox {
		width: 670rpx;
		margin-left: 40rpx;
		padding-top: 50rpx;
		padding-bottom: 50rpx;

		.commentItem {
			display: flex;
			flex-direction: column;
			margin-top: 65rpx;
			padding-bottom: 75rpx;
			border-bottom: 1rpx solid #121212;

			.commentImgBox {
				width: 590rpx;
				margin-left: 80rpx;
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
				/* 允许换行 */
				margin-top: 40rpx;

				.commentImgItem {
					width: 138rpx;
					height: 138rpx;
					margin-bottom: 10rpx;
					border-radius: 10rpx;
				}
			}

			.commentInfo {
				font-weight: 500;
				width: 590rpx;
				line-height: 48rpx;
				font-size: 24rpx;
				color: #121212;
				letter-spacing: 2rpx;
				margin-left: 80rpx;
			}

			.userInfoBox {
				display: flex;
				align-items: center;

				.rate {
					margin-left: auto;
				}

				.name {
					font-weight: 700;
					width: 400rpx;
					font-size: 24rpx;
					color: #121212;
					margin-left: 35rpx;
				}

				.avatar {
					width: 43rpx;
					height: 43rpx;
				}
			}
		}

		.commentTop {
			display: flex;
			align-items: center;
			padding-bottom: 45rpx;
			border-bottom: 1rpx solid #121212;

			.commentAll {
				font-weight: 500;
				font-size: 24rpx;
				color: #8E8E8E;
				margin-left: auto;
			}

			.commentTotal {
				font-weight: 500;
				font-size: 24rpx;
				color: #121212;
			}

			.commentLabel {
				font-weight: 700;
				font-size: 26rpx;
				color: #121212;
			}
		}
	}

	.content {
		width: 100%;
		height: 100vh;
	}
</style>